import logging

log_file = './logs/bot.log'

# 创建一个用于记录一般信息的日志处理器
logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)

file_handler = logging.FileHandler(log_file)
logger.addHandler(file_handler)


def log_record(messages, types="prompt"):
    if types == "prompt":
        logger.info(f"Prompt: {messages}")
    elif types == "response":
        logger.info(f"Response: {messages}")
    else:
        logger.error(messages)
